fix(autofix): Remove unconfigured projects gate and remove code mapping repos fallback#113077
Open
fix(autofix): Remove unconfigured projects gate and remove code mapping repos fallback#113077
Conversation
read_preference_from_sentry_db now always returns a SeerProjectPreference instead of None, removing the has_configured_options gate that could incorrectly treat mechanically-written default options as "configured". _resolve_project_preference now checks preference.repositories instead of just truthiness — when repos are empty it falls through to the code mapping fallback while preserving the user's existing stopping point and handoff settings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Backend Test FailuresFailures on
|
srest2021
commented
Apr 15, 2026
| if pref: | ||
| repo_definitions = pref.repositories | ||
| if pref.automation_handoff: | ||
| auto_create_pr = pref.automation_handoff.auto_create_pr |
Member
Author
There was a problem hiding this comment.
This renaming stuff is due to mypy. read_preference_from_sentry_db guarantees SeerProjectPreference but get_project_seer_preferences can return None. I'll just rename the Seer API call result since it'll get removed soon.
srest2021
commented
Apr 15, 2026
| underlying read path (Sentry DB or Seer API).""" | ||
| if features.has("organizations:seer-project-settings-read-from-sentry", organization): | ||
| return bulk_read_preferences_from_sentry_db(organization.id, project_ids) | ||
| return bulk_read_preferences_from_sentry_db(organization.id, project_ids) # type: ignore[return-value] |
Member
Author
There was a problem hiding this comment.
Again mypy. Return type here is dict[int, SeerProjectPreference] so I think it's ok to override mypy
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Backend Test FailuresFailures on
|
Mock _resolve_project_preference to return a SeerProjectPreference with repos instead of None, since trigger_autofix no longer falls back to code mapping repos. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Backend Test FailuresFailures on
|
JoshFerge
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Sentry DB project preference read helpers had a
has_configured_optionsgate that returnedNonefor projects with no repos and no non-default options. This was problematic because the gate could treat a pref with no repos and explicitly set default options as unconfigured and return None, and_resolve_project_preferencewould then create a new pref using code mapping repos. We also don't want to fall back to code mappings or create new prefs with them, since we'd be adding to users' bills.In this PR:
read_preference_from_sentry_dbandbulk_read_preferences_from_sentry_dbnow always return aSeerProjectPreference(neverNone). Clean up callsites that had redundantif preference:guards on the Sentry DB read path._resolve_project_preferenceto return the existing preference as-is (even with empty repos) and remove the code mapping fallback intrigger_autofix. When no preference exists (Seer API returnedNone), creates a new one with empty repos and org defaults.The night shift cron job is unaffected — it already filters on
pref.repositoriesandpref.autofix_automation_tuning != OFF, so receiving a default preference instead ofNonedoesn't change which projects are selected.